home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Sound / A-Law sdec⁄scom / ALAW.r < prev    next >
Encoding:
Text File  |  1997-06-18  |  3.7 KB  |  106 lines  |  [TEXT/CWIE]

  1. /*
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    Defines needed to make a fat sound decompressor and compressor 'thng' resource.
  5. **
  6. **    by Mark Cookson, Apple Developer Technical Support
  7. **
  8. **    File:    ALAW.r
  9. **
  10. **    Copyright ©1996 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "Apple Sample
  17. **    Code" after having made changes. If you're going to re-distribute the
  18. **    source, we require that you make it clear in the source that the code
  19. **    was descended from Apple Sample Code, but that you've made changes.
  20. */
  21.  
  22. #define UseExtendedThingResource    1                    // we want the extended thng resource
  23. #define SystemSevenOrLater             1                    // we only run with System 7, right?
  24. #define FATCOMPONENT                1
  25.  
  26. #include "Types.r"
  27. #include "SysTypes.r"
  28.  
  29. #define kSoundDecompressor            'sdec'
  30. #define kSoundCompressor            'scom'
  31. #define k16BitIn                    (1 << 2)
  32. #define k16BitOut                    (1 << 10)
  33.  
  34. //#define    kRequiredSndMgrMajorRev =     0x03,                // 3.0 or later required
  35. //#define    kRequiredSndMgrMinorRev =     0x00                
  36.  
  37. #define kALAWVersion            0x00010000                // version for this sound component
  38. #define kALAWSubType            'ALAW'                    // codec type
  39. #define kManufacturerType        'appl'                    // manufacturer
  40.  
  41. #define ALAWDecompressorID        911                        // resource ID for MSG decompressor
  42. #define ALAWCompressorID        912                        // resource ID for MSG compressor
  43.  
  44. #define k68KCodeResType            'cdec'                    // resource type for 68K code
  45. #define kPPCCodeResType            'cdek'                    // resource type for PowerPC code
  46.  
  47. #define kDecompressorFlags        (cmpWantsRegisterMessage | k16BitIn | k16BitOut)
  48. #define kCompressorFlags        (cmpWantsRegisterMessage | k16BitIn | k16BitOut)
  49.  
  50. // A-Law Decompressor, 68K, PPC
  51.  
  52. resource 'thng' (ALAWDecompressorID, "A-Law decompressor") {
  53.     kSoundDecompressor, kALAWSubType, kManufacturerType,                    // types
  54.     kDecompressorFlags, kAnyComponentFlagsMask,                                // flags
  55. #if FATCOMPONENT
  56.     k68KCodeResType,    ALAWDecompressorID,                                    // code
  57. #else
  58.     0,                    0,                                                    // no 68K code
  59. #endif
  60.     'STR ',                ALAWDecompressorID,                                    // name
  61.     'STR ',                 ALAWDecompressorID+1,                                // info
  62.     'ICON',             ALAWDecompressorID,                                    // icon
  63.     kALAWVersion,                                                            // version
  64.     componentDoAutoVersion | componentHasMultiplePlatforms,                    // registration flags
  65.     0,                                                                        // icon
  66.     {
  67. #if FATCOMPONENT
  68.         kDecompressorFlags,                                                    // flags
  69.         k68KCodeResType,    ALAWDecompressorID,                                // code
  70.         platform68k,                                                        // platform
  71. #endif
  72.         kDecompressorFlags,                                                    // flags
  73.         kPPCCodeResType,    ALAWDecompressorID,                                // code
  74.         platformPowerPC                                                        // platform
  75.     };
  76. };
  77.  
  78. // A-Law Compressor, 68K, PPC
  79.  
  80. resource 'thng' (ALAWCompressorID, "A-Law compressor") {
  81.     kSoundCompressor, kALAWSubType, kManufacturerType,                        // types
  82.     kCompressorFlags, kAnyComponentFlagsMask,                                // flags
  83. #if FATCOMPONENT
  84.     k68KCodeResType,    ALAWCompressorID,                                    // code
  85. #else
  86.     0,                    0,                                                    // no 68K code
  87. #endif
  88.     'STR ',                ALAWDecompressorID,                                    // name
  89.     'STR ',                 ALAWDecompressorID+1,                                // info
  90.     'ICON',             ALAWDecompressorID,                                    // icon
  91.     kALAWVersion,                                                            // version
  92.     componentDoAutoVersion | componentHasMultiplePlatforms,                    // registration flags
  93.     0,                                                                        // icon
  94.     {
  95. #if FATCOMPONENT
  96.         kCompressorFlags,                                                    // flags
  97.         k68KCodeResType,    ALAWCompressorID,                                // code
  98.         platform68k,                                                        // platform
  99. #endif
  100.         kCompressorFlags,                                                    // flags
  101.         kPPCCodeResType,    ALAWCompressorID,                                // code
  102.         platformPowerPC                                                        // platform
  103.     };
  104. };
  105.  
  106.